﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AutoDWF.NET.Util;
using System.Threading;

namespace AutoDWF.Forms
{
    public partial class LanguageForm : Form
    {
        public LanguageForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (zhCNRadio.Checked)
            {
                IniHelper.IniWriteValue("System", "Language", zhCNRadio.Tag.ToString(), IniHelper.configFilePath);
                Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-CN");
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");

            }
            else if (zhTWRadio.Checked)
            {
                IniHelper.IniWriteValue("System", "Language", zhTWRadio.Tag.ToString(), IniHelper.configFilePath);
                Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-TW");
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-TW");
            }
            else if (enRadio.Checked)
            {
                IniHelper.IniWriteValue("System", "Language", enRadio.Tag.ToString(), IniHelper.configFilePath);
                Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
            }

            this.DialogResult = DialogResult.OK;
        }
    }
}
